package com.koron.ticket.work.workticket.mapper;

import com.koron.bean.workflow.WorkflowUser;
import com.koron.common.core.business.workflow.bean.po.SysWorkflow;
import com.koron.ticket.spotcheck.bean.WorkSpotBo;
import com.koron.ticket.work.worklocation.bean.WorkLocationBean;
import com.koron.ticket.work.workteam.bean.WorkTeam;
import com.koron.ticket.work.workticket.bean.WorkTicket;
import com.koron.ticket.work.workticket.bean.WorkTicketQuery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

public interface WorkTicketMapper {
    void insert(WorkTicket workTicket);

    void update(WorkTicket workTicket);

    WorkTicket getSingle(WorkTicketQuery workTicketQuery);

    WorkTicket queryById(@Param("id") String id);

    List<WorkTicket> getListAndPaging(WorkTicketQuery workTicketQuery);

    Integer count(WorkTicketQuery workTicketQuery);

    void deleteById(@Param("id") String id);

    int updateDeleteFlagById(@Param("id") String id);//工作票改为软删除

    // 更新最后更新时间，用于排序信息过期问题
    int updateUpdateTimeAndUpdateUserIdAndUpdateUserNameById(@Param("updateTime") Date updateTime, @Param("updateBy") String updateBy, @Param("updateByName") String updateByName, @Param("id") String id);//更新最后更新时间

    String getLastCodeByUnit(@Param("unit") String unit, @Param("type") String type);

    List<WorkTicket> getListForChangeShifts(WorkTicketQuery workTicketQuery);

    @Select(" select name, account as code from s_app_user where org_id = #{orgId}; ")
    List<WorkflowUser> queryThisUnitAccounts(String orgId);

    List<WorkTicket> queryTicketByOrderId(@Param("orderId") String orderId);

    List<WorkSpotBo> queryAllEffective(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<WorkTeam> queryWorkTeamByWorkTicketId(@Param("workTicketIds") List<String> workTicketIds);

    List<WorkLocationBean> queryWorkLocationBeanByWorkTicketId(@Param("workTicketIds") List<String> workTicketIds);

    int updatePreviewFlagById(@Param("updatedPreviewFlag") Integer updatedPreviewFlag, @Param("id") String id);

    SysWorkflow querypermit(@Param("id") String id);
}
